package com.lycos.ludrien.client;


public class MainClient {

	public static void main(String[] args) {

		System.out.print("Initialisation du Moteur ... ");
		Moteur.initialiser();
		System.out.println(" OK");
		System.out.println("=====================================");
		for (int i = 1; i <= 11; i++){

			String num;
			if (i < 10)
				num = "0" + i;
			else num = String.valueOf(i);

			Requete q = ReadQueries.hashmap_queries.get("q"+num);
			RequetePonderee qp = ReadQueries.hashmap_queriesP.get("q"+num);
			
			System.out.println("Traitement de la requete : "+num);
			System.out.println("Mots : " + q.getRequete());
			System.out.println("+ : " + qp.getRequeteFinale())
			;
			

			Resultat r = q.traiter();
			Resultat rp = qp.traiter();
			
			Qrel l = new Qrel("qrel"+num+".txt");
			
			int nbp = l.nbPertinant();
			int nbpr = r.nbPertinant();
			int nbprp = rp.nbPertinant();
			int gain = nbprp - nbpr;
			
			float rc5  = (float) Math.round(l.getRappelClasse(r, 5) * 1000) / (float) 10;
			float rc10  = (float) Math.round(l.getRappelClasse(r, 10) * 1000) / (float) 10;
			float rc25  = (float) Math.round(l.getRappelClasse(r, 25) * 1000) / (float) 10;
			
			float pc5  = (float) Math.round(l.getPrecisionClasse(r, 5) * 1000) / (float) 10;
			float pc10  = (float) Math.round(l.getPrecisionClasse(r, 10) * 1000) / (float) 10;
			float pc25  = (float) Math.round(l.getPrecisionClasse(r, 25) * 1000) / (float) 10;
			
			float rc5p  = (float) Math.round(l.getRappelClasse(rp, 5) * 1000) / (float) 10;
			float rc10p= (float) Math.round(l.getRappelClasse(rp, 10) * 1000) / (float) 10;
			float rc25p  = (float) Math.round(l.getRappelClasse(rp, 25) * 1000) / (float) 10;
			
			float pc5p  = (float) Math.round(l.getPrecisionClasse(rp, 5) * 1000) / (float) 10;
			float pc10p  = (float) Math.round(l.getPrecisionClasse(rp, 10) * 1000) / (float) 10;
			float pc25p  = (float) Math.round(l.getPrecisionClasse(rp, 25) * 1000) / (float) 10;
			
			float gr5 = (float) Math.round((rc5p - rc5) * 10) / (float) 10;
			float gr10 = (float) Math.round((rc10p - rc10) * 10) / (float) 10;
			float gr25 = (float) Math.round((rc25p - rc25) * 10) / (float) 10;
			float gp5 = (float) Math.round((pc5p - pc5) * 10) / (float) 10;
			float gp10 = (float) Math.round((pc10p - pc10) * 10) / (float) 10;
			float gp25 = (float) Math.round((pc25p - pc25) * 10) / (float) 10;
			
			//AFFICHAGE :
			System.out.println("RESULTAT : " + "SO : " + nbpr + ", AO :" + nbprp +", GAIN : " + gain + ", QREL : " + nbp );
			System.out.println("5  => RAPPEL : SO " + rc5 + " AO " + rc5p + " GAIN " + gr5 + " PRECISION : SO : " + pc5 + " AO " + pc5p + " GAIN " + gp5);
			System.out.println("10 => RAPPEL : SO " + rc10 + " AO " + rc10p + " GAIN " + gr10 + " PRECISION : SO : " + pc10 + " AO " + pc10p + " GAIN " + gp10);
			System.out.println("25 => RAPPEL : SO " + rc25 + " AO " + rc25p + " GAIN " + gr25 + " PRECISION : SO : " + pc25 + " AO " + pc25p + " GAIN " + gp25);
			System.out.println("=====================================");
		}
	}	
}